Skip to content

feat: make library ESM only + use tsup to bundle library - #140

Merged
chrispcampbell merged 3 commits into
mainfrom
chris/138-tsdown
Sep 4, 2026
Merged

feat: make library ESM only + use tsup to bundle library#140
chrispcampbell merged 3 commits into
mainfrom
chris/138-tsdown

Conversation

@chrispcampbell

Copy link
Copy Markdown
Contributor

Fixes #138

See issue for details.

tsup is no longer actively maintained; tsdown (built on rolldown) is the
recommended replacement. This also drops the transitive dependency on
esbuild, which resolves a source of outdated dependency alerts.

The tsdown config preserves the existing output file names (index.js and
index.d.ts for the ESM build, rather than tsdown's default .mjs and
.d.mts), so the published package layout is unchanged.

The moduleResolution setting was changed from "node" to "bundler" because
tsdown only declares its types under an exports field, which the legacy
resolver cannot resolve.
The package is only consumed from ESM contexts, so there is no need to
ship a CommonJS bundle alongside the ESM one.

Since `dist/index.cjs` is no longer produced, the `require` condition is
removed from the `exports` map and `main` now points at the ESM bundle.
The `module` field is also removed; it only existed to distinguish the
ESM bundle from the CommonJS `main`.
Drop the custom `outExtensions` in favor of the tsdown defaults, so the
bundle is emitted as `index.mjs` with types in `index.d.mts`.

The `main`, `types`, and `exports` fields are updated to match, as is the
import in the `docs-builder` CLI script.
@chrispcampbell chrispcampbell changed the title feat: use tsup to bundle library + only generate ESM library feat: use tsup to bundle library + make library ESM only Sep 4, 2026
@chrispcampbell chrispcampbell changed the title feat: use tsup to bundle library + make library ESM only feat: make library ESM only + use tsup to bundle library Sep 4, 2026
@chrispcampbell
chrispcampbell merged commit 318804b into main Sep 4, 2026
1 check passed
@chrispcampbell
chrispcampbell deleted the chris/138-tsdown branch September 4, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace tsup with tsdown

1 participant